package 面向对象中级.访问权限修饰符;

public class A {
    //四种变量
    public int n1 = 10;
    protected int n2 = 20;
    int n3 = 30;
    private int n4 = 40;

    //四种方法
    public void a1() {
        System.out.println("a1");
    }

    protected void a2() {
        System.out.println("a2");
    }

    void a3() {
        System.out.println("a3");
    }

    private void a4() {
        System.out.println("a4");
    }


    //测试的方法
    public void print() {
        System.out.println(n1);
        System.out.println(n2);
        System.out.println(n3);
        System.out.println(n4);

        a1();
        a2();
        a3();
        a4();
    }
}
